﻿
using Chloe.Entity;
using Chloe.SqlServer;
using Infrastructure.Excel;
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Text;
using System.Threading.Tasks;

namespace Test
{
    class Program
    {
        public static string ConnectionString = "Server=.;Initial Catalog=MyDB;User ID=sa;Password=asdf.123";
        static void Main(string[] args)
        {

            SendSql("OK");
            DateTime t1 = DateTime.Parse("2019-01-23 12:59:01");

            DateTime t2 = DateTime.Parse("2019-01-23 13:59:01");
            int t=(t2 - t1).Seconds;
            double t3 = (t2 - t1).TotalSeconds;
        }
        public static string SendSql(string sql)
        {
            IPAddress ip = IPAddress.Parse("192.168.0.110");
            IPEndPoint ipe = new IPEndPoint(ip, 12589);//把ip和端口转化为IPEndPoint实例
            Socket c = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);//创建一个Socket
            c.Connect(ipe);//连接到服务器

            byte[] bs = Encoding.UTF8.GetBytes(sql);
            c.Send(bs, bs.Length, 0);//发送测试信息
            string recvStr = "";
            byte[] recvBytes = new byte[1024];
            int bytes;
            bytes = c.Receive(recvBytes, recvBytes.Length, 0);//从服务器端接受返回信息
            recvStr += Encoding.UTF8.GetString(recvBytes, 0, bytes);
            c.Close();
            return recvStr;
        }
    }
    [TableAttribute("MeetUser")]
    public class MeetUser
    {
        [NonAutoIncrement]
        [Column(IsPrimaryKey = true, Name = "Id")]
        public System.Guid Id { get; set; }
        public string CompanyName { get; set; }
        public string Position { get; set; }
        public string UserName { get; set; }
        public string PhoneNum { get; set; }
        public string HeadUrl { get; set; }




    }
    [TableAttribute("AccessRecord")]
    public class AccessRecord 
    {
        [NonAutoIncrement]
        [Column(IsPrimaryKey = true, Name = "Id")]
        public System.Guid Id { get; set; }
        public Guid UserId { get; set; }
        public Guid MobileId { get; set; }
        public string CreateDate { get; set; }
    }
}
